//
//  ByNoticeSuperResultVIew.m
//  caipiao_ios
//
//  Created by mc on 2018/8/9.
//  Copyright © 2018年 ZhangZhanbin. All rights reserved.
//

#import "ByNoticeSuperResultVIew.h"



@implementation ByNoticeSuperResultVIew

- (id)init{
    self = [super init];
    if (self) {
        
        ByNoticeThreeLabelView *leftView = [[ByNoticeThreeLabelView alloc] init];
        [self addSubview:leftView];
        [leftView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).offset(0);
            make.top.equalTo(self).offset(0);
            make.bottom.equalTo(self).offset(0);
            make.width.mas_equalTo(@100);
        }];
        
        
        ByNoticeThreeLabelView *centerView = [[ByNoticeThreeLabelView alloc] init];
        [self addSubview:centerView];
        [centerView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(leftView.mas_right).offset(0);
            make.top.equalTo(self).offset(0);
            make.bottom.equalTo(self).offset(0);
            make.width.mas_equalTo(@100);
        }];
        centerView.titleLabel.text = @"中奖注数";
        centerView.valueLabel.textColor = BY_THEME_COLOR;
        centerView.otherValueLabel.textColor = BY_THEME_COLOR;
        
        ByNoticeThreeLabelView *rightView = [[ByNoticeThreeLabelView alloc] init];
        [self addSubview:rightView];
        [rightView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(centerView.mas_right).offset(0);
            make.top.equalTo(self).offset(0);
            make.bottom.equalTo(self).offset(0);
            make.width.mas_equalTo(@100);
        }];
        rightView.titleLabel.text = @"每注奖金(元)";
        rightView.valueLabel.textColor = BY_THEME_COLOR;
        rightView.otherValueLabel.textColor = BY_THEME_COLOR;
    
        self.leftView = leftView;
        self.centerView = centerView;
        self.rightView = rightView;
    }
    return self;
}

- (void)setNetModel:(ByNetModel *)netModel{
    _netModel = netModel;
    
    
        
        //双色球
        if (_netModel.category_id.integerValue == 1001) {
            
            if (_netModel.contentArray.count > 1) {
                
            NSArray *array1 = [_netModel.contentArray objectAtIndex:0];
            NSArray *array2 = [_netModel.contentArray objectAtIndex:1];
            
            self.centerView.valueLabel.text = [array1 objectAtIndex:1];
            self.centerView.otherValueLabel.text = [array2 objectAtIndex:1];
            
            self.rightView.valueLabel.text = [NSString balanceFormatFromStr:[NSString stringWithFormat:@"%@",[array1 lastObject]]];
            self.rightView.otherValueLabel.text = [NSString balanceFormatFromStr:[NSString stringWithFormat:@"%@", [array2 lastObject]]];
                
            }
            
        //大乐透
        }else if (_netModel.category_id.integerValue == 2001){
            
             NSArray *array1 = _netModel.contentDic[@"一"][@"j"];
             NSArray *array2 = _netModel.contentDic[@"二"][@"j"];
            
            self.centerView.valueLabel.text = [array1 firstObject];
            self.centerView.otherValueLabel.text = [array2 firstObject];
            
            self.rightView.valueLabel.text = [NSString balanceFormatFromStr:[NSString stringWithFormat:@"%@",[array1 lastObject]]];
            self.rightView.otherValueLabel.text = [NSString balanceFormatFromStr:[NSString stringWithFormat:@"%@", [array2 lastObject]]];
            
            
        }
        
        
    
    
}

@end
